home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 2 / Apprentice-Release2.iso / Source Code / Mark Pilgrim / Jotto ][ 1.2 / source / Wipes reversed ƒ / Quadrant scroll 2 reversed.c < prev    next >
Encoding:
C/C++ Source or Header  |  1994-10-30  |  2.7 KB  |  78 lines  |  [TEXT/MMCC]

  1. #include "timing.h"
  2.  
  3. #define CorrectTime 3
  4. #define theWindowHeight (boundsRect.bottom-boundsRect.top)
  5. #define theWindowWidth (boundsRect.right-boundsRect.left)
  6. #define NUM_ITERATIONS    25
  7.  
  8. pascal short QuadrantScroll2Reversed(GrafPtr sourceGrafPtr, GrafPtr destGrafPtr, Rect boundsRect);
  9.  
  10. /* 4 regions, splitting the screen into 4 quadrants.  Scroll the screen down in
  11.    the top-left quadrant, right in the top-right, up in the bottom-right,
  12.    left in the bottom-left. */
  13.    
  14. pascal short QuadrantScroll2Reversed(GrafPtr sourceGrafPtr, GrafPtr destGrafPtr, Rect boundsRect)
  15. {
  16.     short            x;
  17.     Rect        tlsource, trsource, blsource, brsource;
  18.     Rect        tldest, trdest, bldest, brdest;
  19.     Rect        tlscroll, trscroll, blscroll, brscroll;
  20.     short            cx,cy;
  21.     short            BoxSize, HBoxSize;
  22.     
  23.     BoxSize=theWindowHeight/(NUM_ITERATIONS*2);
  24.     HBoxSize=theWindowWidth/(NUM_ITERATIONS*2);
  25.     
  26.     cx = boundsRect.left + theWindowWidth / 2;
  27.     cy = boundsRect.top + theWindowHeight / 2;
  28.     
  29.     tlscroll=trscroll=blscroll=brscroll=tldest=trdest=bldest=brdest=boundsRect;
  30.     tlscroll.right=trscroll.left=blscroll.right=brscroll.left=
  31.         tldest.right=trdest.left=bldest.right=brdest.left=cx;
  32.     tlscroll.bottom=trscroll.bottom=blscroll.top=brscroll.top=
  33.         tldest.bottom=trdest.bottom=bldest.top=brdest.top=cy;
  34.     brdest.bottom=brdest.top+BoxSize;
  35.     trdest.right=trdest.left+HBoxSize;
  36.     tldest.top=tldest.bottom-BoxSize;
  37.     bldest.left=bldest.right-HBoxSize;
  38.     SetRect(&tlsource, boundsRect.left, boundsRect.top, cx, boundsRect.top+BoxSize);
  39.     SetRect(&blsource, boundsRect.left, cy, boundsRect.left+HBoxSize, boundsRect.bottom);
  40.     SetRect(&brsource, cx, boundsRect.bottom-BoxSize, boundsRect.right, boundsRect.bottom);
  41.     SetRect(&trsource, boundsRect.right-HBoxSize, boundsRect.top, boundsRect.right, cy);
  42.     
  43.     for (x=0; x<NUM_ITERATIONS; x++)
  44.     {
  45.         StartTiming();
  46.         ScrollTheRect(&trscroll, HBoxSize, 0, 0L);
  47.         CopyBits(&(sourceGrafPtr->portBits), &(destGrafPtr->portBits),
  48.                 &trsource, &trdest, 0, 0L);
  49.         trsource.left-=HBoxSize;
  50.         trsource.right-=HBoxSize;
  51.         
  52.         ScrollTheRect(&brscroll, 0, BoxSize, 0L);
  53.         CopyBits(&(sourceGrafPtr->portBits), &(destGrafPtr->portBits),
  54.                 &brsource, &brdest, 0, 0L);
  55.         brsource.top-=BoxSize;
  56.         brsource.bottom-=BoxSize;
  57.         
  58.         ScrollTheRect(&blscroll, -HBoxSize, 0, 0L);
  59.         CopyBits(&(sourceGrafPtr->portBits), &(destGrafPtr->portBits),
  60.                 &blsource, &bldest, 0, 0L);
  61.         blsource.left+=HBoxSize;
  62.         blsource.right+=HBoxSize;
  63.         
  64.         ScrollTheRect(&tlscroll, 0, -BoxSize, 0L);
  65.         CopyBits(&(sourceGrafPtr->portBits), &(destGrafPtr->portBits),
  66.                 &tlsource, &tldest, 0, 0L);
  67.         tlsource.top+=BoxSize;
  68.         tlsource.bottom+=BoxSize;
  69.         
  70.         TimeCorrection(CorrectTime);
  71.     }
  72.     
  73.     CopyBits(&(sourceGrafPtr->portBits), &(destGrafPtr->portBits),
  74.         &boundsRect, &boundsRect, 0, 0L);
  75.     
  76.     return 0;
  77. }
  78.